package com.ming.sportdemo.controller;

import com.ming.sportdemo.bean.Util;
import com.ming.sportdemo.annotation.Test;
import com.ming.sportdemo.service.UtilService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@Controller
public class TestController {

    @Autowired
    UtilService utilService;

    @Test
    @RequestMapping("/test1")
    public String test(@RequestParam("id") Integer id, HttpServletRequest request){
        String header = request.getHeader("test");
        System.out.println("header:"+header);
        Util util = utilService.getById(id);
        System.out.println("id:"+id+util);
    return "返回："+util;
    }

    @RequestMapping("/pay")
    public String pay(){
        return "pay";
    }
}
